package com.deyuanyun.pic.pipe.controller.vo.merge;

import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.common.util.format.NumberFormat;
import com.deyuanyun.pic.pipe.controller.vo.BaseVO;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.pipe.domain.Elbow;
import com.deyuanyun.pic.settings.support.biz.CodeUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

/**
 * 热煨弯头信息表_PIC_PIPE_ELBOW
 */
public class ElbowVO extends BaseVO<Elbow> {

    // 管道名称
    private String pipeLineName;
    // 弯头编号
    private String elbowNumber;
    // 上游环焊缝焊接编号
    private String ugwwId;
    // 下游环焊缝焊接编号
    private String dgwwId;
    // 绝对距离(m)
    private String mileage;
    // 相对最近参考点
    private String reference;
    // 相对最近参考点距离(m)
    private String referenceDistance;
    // 材质
    private String material;
    // 防腐材料
    private String antisepticMaterial;
    // 压力等级（MPa）
    private String pressureRating;
    // 弯头角度（°）
    private String elbowAngle;
    // 弯头类型
    private String elbowType;
    // 曲率半径(D)
    private String elbowCurvrad;
    // 出口直径(mm)
    private String outletDiameter;
    // 出口壁厚(mm)
    private String outletWallThickness;
    // 出口连接类型
    private String outletConnectionType;
    // 生产厂家
    private String manufacturer;
    // 防腐层制造厂商
    private String coatingManufacturer;
    // 生成日期
    private String manufacturedDate;
    // 链接GIS结果表
    private String gisId;

    public String getPipeLineName() {
        return pipeLineName;
    }

    public void setPipeLineName(String pipeLineName) {
        this.pipeLineName = pipeLineName;
    }

    public String getElbowNumber() {
        return elbowNumber;
    }

    public void setElbowNumber(String elbowNumber) {
        this.elbowNumber = elbowNumber;
    }

    public String getUgwwId() {
        return ugwwId;
    }

    public void setUgwwId(String ugwwId) {
        this.ugwwId = ugwwId;
    }

    public String getDgwwId() {
        return dgwwId;
    }

    public void setDgwwId(String dgwwId) {
        this.dgwwId = dgwwId;
    }

    public String getMileage() {
        return mileage;
    }

    public void setMileage(String mileage) {
        this.mileage = mileage;
    }

    public String getReference() {
        return reference;
    }

    public void setReference(String reference) {
        this.reference = reference;
    }

    public String getReferenceDistance() {
        return referenceDistance;
    }

    public void setReferenceDistance(String referenceDistance) {
        this.referenceDistance = referenceDistance;
    }

    public String getMaterial() {
        return material;
    }

    public void setMaterial(String material) {
        this.material = material;
    }

    public String getAntisepticMaterial() {
        return antisepticMaterial;
    }

    public void setAntisepticMaterial(String antisepticMaterial) {
        this.antisepticMaterial = antisepticMaterial;
    }

    public String getPressureRating() {
        return pressureRating;
    }

    public void setPressureRating(String pressureRating) {
        this.pressureRating = pressureRating;
    }

    public String getElbowAngle() {
        return elbowAngle;
    }

    public void setElbowAngle(String elbowAngle) {
        this.elbowAngle = elbowAngle;
    }

    public String getElbowType() {
        return elbowType;
    }

    public void setElbowType(String elbowType) {
        this.elbowType = elbowType;
    }

    public String getElbowCurvrad() {
        return elbowCurvrad;
    }

    public void setElbowCurvrad(String elbowCurvrad) {
        this.elbowCurvrad = elbowCurvrad;
    }

    public String getOutletDiameter() {
        return outletDiameter;
    }

    public void setOutletDiameter(String outletDiameter) {
        this.outletDiameter = outletDiameter;
    }

    public String getOutletWallThickness() {
        return outletWallThickness;
    }

    public void setOutletWallThickness(String outletWallThickness) {
        this.outletWallThickness = outletWallThickness;
    }

    public String getOutletConnectionType() {
        return outletConnectionType;
    }

    public void setOutletConnectionType(String outletConnectionType) {
        this.outletConnectionType = outletConnectionType;
    }

    public String getManufacturer() {
        return manufacturer;
    }

    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }

    public String getCoatingManufacturer() {
        return coatingManufacturer;
    }

    public void setCoatingManufacturer(String coatingManufacturer) {
        this.coatingManufacturer = coatingManufacturer;
    }

    public String getManufacturedDate() {
        return manufacturedDate;
    }

    public void setManufacturedDate(String manufacturedDate) {
        this.manufacturedDate = manufacturedDate;
    }

    public String getGisId() {
        return gisId;
    }

    public void setGisId(String gisId) {
        this.gisId = gisId;
    }

    @Override
    public void fromDomain(Elbow domain) {

        if (ObjectUtil.isEmptyAll(domain)) {
            return;
        }
        // 管道名称
        this.pipeLineName = PipeLineUtil.getPipeLineName(domain.getPipeLineId());
        // 弯头编号
        this.elbowNumber = domain.getElbowNumber();
        // 上游环焊缝焊接编号
        this.ugwwId = domain.getUgwwId();
        // 下游环焊缝焊接编号
        this.dgwwId = domain.getDgwwId();
        // 绝对距离(m)
        this.mileage = NumberFormat.format(domain.getMileage(), NumberFormat.FMT_PLACES3);
        // 相对最近参考点
        this.reference = domain.getReference();
        // 相对最近参考点距离(m)
        this.referenceDistance = NumberFormat.format(domain.getReferenceDistance(), NumberFormat.FMT_PLACES3);
        // 材质
        this.material = CodeUtil.getName(domain.getMaterial());
        // 防腐材料
        this.antisepticMaterial = CodeUtil.getName(domain.getAntisepticMaterial());
        // 压力等级（MPa）
        this.pressureRating = NumberFormat.format(domain.getPressureRating());
        // 弯头角度（°）
        this.elbowAngle = NumberFormat.format(domain.getElbowAngle());
        // 弯头类型
        this.elbowType = CodeUtil.getName(domain.getElbowType());
        // 曲率半径(D)
        this.elbowCurvrad = NumberFormat.format(domain.getElbowCurvrad());
        // 出口直径(mm)
        this.outletDiameter = NumberFormat.format(domain.getOutletDiameter());
        // 出口壁厚(mm)
        this.outletWallThickness = NumberFormat.format(domain.getOutletWallThickness());
        // 出口连接类型
        this.outletConnectionType = CodeUtil.getName(domain.getOutletConnectionType());
        // 生产厂家
        this.manufacturer = domain.getManufacturer();
        // 防腐层制造厂商
        this.coatingManufacturer = domain.getCoatingManufacturer();
        // 生成日期
        this.manufacturedDate = DateFormat.format(domain.getManufacturedDate());
        // 链接GIS结果表
        this.gisId = domain.getGisId();

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordtime(), domain.getCreateRemark());
    }

    public Page<ElbowVO> fromDomainList(Page<Elbow> domainList) {
        Page<ElbowVO> list = new Page<ElbowVO>();
        for (Elbow elbow : domainList) {
            ElbowVO elbowVO = new ElbowVO();
            elbowVO.fromDomain(elbow);
            list.add(elbowVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}